package Logic;

import Model.fontWebsite;

public class normModule 
{
	
	private static normModule instance = null;
	
	private normModule() {}
	
	public static normModule getInstance() 
	{
		if(instance == null) 
		{
		   instance = new normModule();
		}
		return instance;
	}
	
	
	/* Types:
	 * 
	 *  1 - Title
	 *  2 - Body
	 *  3 - Date
	 *  
	 */
	
	public String getNormalizedText(int type, fontWebsite font, String HTML)
	{
		String res = "";
		if ( type == 1 )
		{
			res = HTML.replaceAll("^.*?"+font.getRuleTitle(), "");
			res = res.replaceAll(font.getRuleTitle2()+".*?$", "");
			return res;
		}
		else if ( type == 2 )
		{
			res = HTML.replaceAll("^.*?"+font.getRuleBody(), "");
			res = res.replaceAll(font.getRuleBody2()+".*?$", "");
			return res;
		}
		else if ( type == 3 )
		{
			res = HTML.replaceAll("^.*?"+font.getRuleDate(), "");
			res = res.replaceAll(font.getRuleDate2()+".*?$", "");
			return res;
		}
		else 
		{
			System.out.print("Wrong type!\n");
			return "";
		}
	}

}
